package com.upb.webserver.dao.mapper;

import com.upb.webserver.dao.entity.TbNode;
import com.upb.webserver.dao.entity.TbNodeExample;
import java.util.List;
import java.util.Optional;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectKey;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;

public interface TbNodeMapper {
    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_node
     *
     * @mbg.generated
     */
    @SelectProvider(type=TbNodeSqlProvider.class, method="countByExample")
    long countByExample(TbNodeExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_node
     *
     * @mbg.generated
     */
    @DeleteProvider(type=TbNodeSqlProvider.class, method="deleteByExample")
    int deleteByExample(TbNodeExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_node
     *
     * @mbg.generated
     */
    @Delete({
        "delete from tb_node",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int deleteByPrimaryKey(Integer id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_node
     *
     * @mbg.generated
     */
    @Insert({
        "insert into tb_node (remote_id, chain_type, ",
        "chain_id, application_id, ",
        "host_id, type, port, ",
        "name, status, gmt_create, ",
        "gmt_modified, description)",
        "values (#{remoteId,jdbcType=INTEGER}, #{chainType,jdbcType=TINYINT}, ",
        "#{chainId,jdbcType=INTEGER}, #{applicationId,jdbcType=INTEGER}, ",
        "#{hostId,jdbcType=INTEGER}, #{type,jdbcType=TINYINT}, #{port,jdbcType=INTEGER}, ",
        "#{name,jdbcType=VARCHAR}, #{status,jdbcType=TINYINT}, #{gmtCreate,jdbcType=TIMESTAMP}, ",
        "#{gmtModified,jdbcType=TIMESTAMP}, #{description,jdbcType=LONGVARCHAR})"
    })
    @SelectKey(statement="SELECT LAST_INSERT_ID()", keyProperty="id", before=false, resultType=Integer.class)
    int insert(TbNode record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_node
     *
     * @mbg.generated
     */
    @InsertProvider(type=TbNodeSqlProvider.class, method="insertSelective")
    @SelectKey(statement="SELECT LAST_INSERT_ID()", keyProperty="id", before=false, resultType=Integer.class)
    int insertSelective(TbNode record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_node
     *
     * @mbg.generated
     */
    @SelectProvider(type=TbNodeSqlProvider.class, method="selectByExampleWithBLOBs")
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.INTEGER, id=true),
        @Result(column="remote_id", property="remoteId", jdbcType=JdbcType.INTEGER),
        @Result(column="chain_type", property="chainType", jdbcType=JdbcType.TINYINT),
        @Result(column="chain_id", property="chainId", jdbcType=JdbcType.INTEGER),
        @Result(column="application_id", property="applicationId", jdbcType=JdbcType.INTEGER),
        @Result(column="host_id", property="hostId", jdbcType=JdbcType.INTEGER),
        @Result(column="type", property="type", jdbcType=JdbcType.TINYINT),
        @Result(column="port", property="port", jdbcType=JdbcType.INTEGER),
        @Result(column="name", property="name", jdbcType=JdbcType.VARCHAR),
        @Result(column="status", property="status", jdbcType=JdbcType.TINYINT),
        @Result(column="gmt_create", property="gmtCreate", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="gmt_modified", property="gmtModified", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="description", property="description", jdbcType=JdbcType.LONGVARCHAR)
    })
    List<TbNode> selectByExampleWithBLOBs(TbNodeExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_node
     *
     * @mbg.generated
     */
    @SelectProvider(type=TbNodeSqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.INTEGER, id=true),
        @Result(column="remote_id", property="remoteId", jdbcType=JdbcType.INTEGER),
        @Result(column="chain_type", property="chainType", jdbcType=JdbcType.TINYINT),
        @Result(column="chain_id", property="chainId", jdbcType=JdbcType.INTEGER),
        @Result(column="application_id", property="applicationId", jdbcType=JdbcType.INTEGER),
        @Result(column="host_id", property="hostId", jdbcType=JdbcType.INTEGER),
        @Result(column="type", property="type", jdbcType=JdbcType.TINYINT),
        @Result(column="port", property="port", jdbcType=JdbcType.INTEGER),
        @Result(column="name", property="name", jdbcType=JdbcType.VARCHAR),
        @Result(column="status", property="status", jdbcType=JdbcType.TINYINT),
        @Result(column="gmt_create", property="gmtCreate", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="gmt_modified", property="gmtModified", jdbcType=JdbcType.TIMESTAMP)
    })
    List<TbNode> selectByExample(TbNodeExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_node
     *
     * @mbg.generated
     */
    @Select({
        "select",
        "id, remote_id, chain_type, chain_id, application_id, host_id, type, port, name, ",
        "status, gmt_create, gmt_modified, description",
        "from tb_node",
        "where id = #{id,jdbcType=INTEGER}"
    })
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.INTEGER, id=true),
        @Result(column="remote_id", property="remoteId", jdbcType=JdbcType.INTEGER),
        @Result(column="chain_type", property="chainType", jdbcType=JdbcType.TINYINT),
        @Result(column="chain_id", property="chainId", jdbcType=JdbcType.INTEGER),
        @Result(column="application_id", property="applicationId", jdbcType=JdbcType.INTEGER),
        @Result(column="host_id", property="hostId", jdbcType=JdbcType.INTEGER),
        @Result(column="type", property="type", jdbcType=JdbcType.TINYINT),
        @Result(column="port", property="port", jdbcType=JdbcType.INTEGER),
        @Result(column="name", property="name", jdbcType=JdbcType.VARCHAR),
        @Result(column="status", property="status", jdbcType=JdbcType.TINYINT),
        @Result(column="gmt_create", property="gmtCreate", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="gmt_modified", property="gmtModified", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="description", property="description", jdbcType=JdbcType.LONGVARCHAR)
    })
    TbNode selectByPrimaryKey(Integer id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_node
     *
     * @mbg.generated
     */
    @UpdateProvider(type=TbNodeSqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("record") TbNode record, @Param("example") TbNodeExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_node
     *
     * @mbg.generated
     */
    @UpdateProvider(type=TbNodeSqlProvider.class, method="updateByExampleWithBLOBs")
    int updateByExampleWithBLOBs(@Param("record") TbNode record, @Param("example") TbNodeExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_node
     *
     * @mbg.generated
     */
    @UpdateProvider(type=TbNodeSqlProvider.class, method="updateByExample")
    int updateByExample(@Param("record") TbNode record, @Param("example") TbNodeExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_node
     *
     * @mbg.generated
     */
    @UpdateProvider(type=TbNodeSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(TbNode record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_node
     *
     * @mbg.generated
     */
    @Update({
        "update tb_node",
        "set remote_id = #{remoteId,jdbcType=INTEGER},",
          "chain_type = #{chainType,jdbcType=TINYINT},",
          "chain_id = #{chainId,jdbcType=INTEGER},",
          "application_id = #{applicationId,jdbcType=INTEGER},",
          "host_id = #{hostId,jdbcType=INTEGER},",
          "type = #{type,jdbcType=TINYINT},",
          "port = #{port,jdbcType=INTEGER},",
          "name = #{name,jdbcType=VARCHAR},",
          "status = #{status,jdbcType=TINYINT},",
          "gmt_create = #{gmtCreate,jdbcType=TIMESTAMP},",
          "gmt_modified = #{gmtModified,jdbcType=TIMESTAMP},",
          "description = #{description,jdbcType=LONGVARCHAR}",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int updateByPrimaryKeyWithBLOBs(TbNode record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_node
     *
     * @mbg.generated
     */
    @Update({
        "update tb_node",
        "set remote_id = #{remoteId,jdbcType=INTEGER},",
          "chain_type = #{chainType,jdbcType=TINYINT},",
          "chain_id = #{chainId,jdbcType=INTEGER},",
          "application_id = #{applicationId,jdbcType=INTEGER},",
          "host_id = #{hostId,jdbcType=INTEGER},",
          "type = #{type,jdbcType=TINYINT},",
          "port = #{port,jdbcType=INTEGER},",
          "name = #{name,jdbcType=VARCHAR},",
          "status = #{status,jdbcType=TINYINT},",
          "gmt_create = #{gmtCreate,jdbcType=TIMESTAMP},",
          "gmt_modified = #{gmtModified,jdbcType=TIMESTAMP}",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int updateByPrimaryKey(TbNode record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_node
     *
     * @mbg.generated
     */
    @Options(useGeneratedKeys = true,keyProperty="id",keyColumn = "id")
    @Insert({
    "<script>",
        "insert into tb_node (remote_id, ",
        "chain_type, chain_id, ",
        "application_id, host_id, ",
        "type, port, ",
        "name, status, ",
        "gmt_create, gmt_modified, ",
        "description)",
        "values<foreach collection=\"list\" item=\"detail\" index=\"index\" separator=\",\">(#{detail.remoteId,jdbcType=INTEGER}, ",
        "#{detail.chainType,jdbcType=TINYINT}, #{detail.chainId,jdbcType=INTEGER}, ",
        "#{detail.applicationId,jdbcType=INTEGER}, #{detail.hostId,jdbcType=INTEGER}, ",
        "#{detail.type,jdbcType=TINYINT}, #{detail.port,jdbcType=INTEGER}, ",
        "#{detail.name,jdbcType=VARCHAR}, #{detail.status,jdbcType=TINYINT}, ",
        "#{detail.gmtCreate,jdbcType=TIMESTAMP}, #{detail.gmtModified,jdbcType=TIMESTAMP}, ",
        "#{detail.description,jdbcType=LONGVARCHAR})</foreach></script>",
    })
    int batchInsert(List<TbNode> list);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_node
     *
     * @mbg.generated
     */
    @SelectProvider(type=TbNodeSqlProvider.class, method="getOneByExample")
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.INTEGER, id=true),
        @Result(column="remote_id", property="remoteId", jdbcType=JdbcType.INTEGER),
        @Result(column="chain_type", property="chainType", jdbcType=JdbcType.TINYINT),
        @Result(column="chain_id", property="chainId", jdbcType=JdbcType.INTEGER),
        @Result(column="application_id", property="applicationId", jdbcType=JdbcType.INTEGER),
        @Result(column="host_id", property="hostId", jdbcType=JdbcType.INTEGER),
        @Result(column="type", property="type", jdbcType=JdbcType.TINYINT),
        @Result(column="port", property="port", jdbcType=JdbcType.INTEGER),
        @Result(column="name", property="name", jdbcType=JdbcType.VARCHAR),
        @Result(column="status", property="status", jdbcType=JdbcType.TINYINT),
        @Result(column="gmt_create", property="gmtCreate", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="gmt_modified", property="gmtModified", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="description", property="description", jdbcType=JdbcType.LONGVARCHAR)
    })
    Optional<TbNode> getOneByExample(TbNodeExample example);
}